package com.random;

import java.util.List;

import com.alibaba.fastjson.JSON;

/**
 * 红包测试
 * 指定红包总金额，最大值，最小值
 * @author yaojinshan
 * @since 2018-04-01 9:56
 */
public class TestRedpacket {
	
	static double totalMoney = 50000.0d;//总金额
	static double[] qujian_ratio  = new double[]{0.1,0.2,0.3,0.4};//区间所占总金额比例
	static int single_quantity = 10;//单个区间红包数量
	public static void main(String[] args) {
		for (int i = 0; i < qujian_ratio.length; i++) {
			initRedpacetArray(totalMoney * qujian_ratio[i]);
		}
	}
	//初始化红包数组
	private static void initRedpacetArray(double money) {
		RedPacketUtil util = new RedPacketUtil();  
		List<Integer> redpackets = util.splitRedPackets((int)(money * 100), single_quantity);
		int temp = 0;
		for (Integer integer : redpackets) {
			temp += integer;
		}
		System.out.println(temp);
		System.out.println(JSON.toJSONString(redpackets));
	}
}
